﻿@using MC.RideEvent.Mvc.Models.Entity
@model MC.RideEvent.Mvc.Models.ViewModel.ProfilMemberViewModel

@{
    ViewBag.Title = "Profil membre";
}

<h2>Profil membre</h2>

<fieldset>
    <legend>Membre</legend>

    <div class="display-label">
         @Html.DisplayName("Nom")
    </div>
    <div class="display-field">
        @Html.Label(Model.Member.Name)
    </div>

    <div class="display-label">
         @Html.DisplayName("Prenom")
    </div>
    <div class="display-field">
        @Html.Label(Model.Member.FirstName)
    </div>

    <div class="display-label">
         @Html.DisplayName("Email")
    </div>
    <div class="display-field">
        <span>@Model.Member.Email</span>
    </div>

    <div class="display-label">
         @Html.DisplayName("Date de naissance")
    </div>
    <div class="display-field">
        <span>@Model.Member.Birthday.ToString("dd MMM yyyy")</span>
    </div>

    <div class="display-label">
         @Html.DisplayName("Adresse")
    </div>
    <div class="display-field">
        @Html.Label(Model.Member.Address)
    </div>

    <div class="display-label">
         @Html.DisplayName("Ville")
    </div>
    <div class="display-field">
        @Html.Label(Model.Member.City)
    </div>

    <div class="display-label">
         @Html.DisplayName("Cp")
    </div>
    <div class="display-field">
        @Html.Label(Model.Member.Cp)
    </div>

    <div class="display-label">
         @Html.DisplayName("Sexe")
    </div>
    <div class="display-field">
        @Html.Label(Model.Member.Sexe)
    </div>

    <div class="display-label">
         @Html.DisplayName("Date obtention du permis")
    </div>
    <div class="display-field">
        <span>@Model.Member.DriveLicenseDateString()</span>
    </div>
</fieldset>
<p>
    @Html.ActionLink("Editer", "Edit", new { id = Model.Member.Id }) 

    @if(Model.Member.DriveLicenceDate != null)
    {
        if (Model.Vehicules.Count <= 1)
        {
            <a id="btnvehicule" href="@Url.Action("VehiculeCreateForm", "Member")">Ajouter un vehicule</a>
        }
        
        if(Model.Vehicules.Count > 0)
        {
            @Html.ActionLink("Mes véhicules", "ListVehicules", "Member")
            <a id="btnpreference">Modifier mes preferences</a>
            @Html.ActionLink("Liste trajet en tant que conducteur", "ListDriverWays", "Member")
            @Html.ActionLink("Liste trajet en tant que passager", "ListPassagerWays", "Member")
        }
    }
    
    <div id="formVehicule" style="display:none">
    </div>
    
    @if (Model.Vehicules.Count > 0)
    {
        <div id="formPreference" style="display: none">
            
        </div>
    }
</p>

<script type="text/javascript">
    $(document).ready(function () {
        $("#btnvehicule").fancybox({
            scrolling: 'no',
            titleShow: false,
            width: 400,
            height: 400,
            autoSize: false,
            //href: '@Url.Action("VehiculeCreateForm", "Member")',
            type: 'ajax'/*, ajax: { type: 'GET' }*/
        });

        $("#btnpreference").fancybox({
            scrolling: 'no',
            titleShow: false,
            width: 400,
            height: 400,
            autoSize: false,
            href: '@Url.Action("PreferenceForm", "Member")',
            type: 'ajax'
        });
    });
</script>